package com.dikeleakagedetection.myapplication

import android.app.Application
import android.content.Context
import cn.leancloud.AVOSCloud

import com.dikeleakagedetection.myapplication.logic.dao.User
import com.dikeleakagedetection.myapplication.logic.model.CurrentBleDevice
import kotlin.properties.Delegates

class DikeLeakageDetectionApp : Application() {
    companion object{
        lateinit var context: Context

        private var INSTANCE: DikeLeakageDetectionApp by Delegates.notNull()
        fun instance() = INSTANCE

        val currentBleDevice = CurrentBleDevice(null, null)

        var user = User(null, null)

    }

    override fun onCreate() {
        super.onCreate()
        context = applicationContext
        INSTANCE = this

        val appId = "bXVikpVPU3C05Iu5kyPd0rHp-gzGzoHsz"
        val appKey = "LNStMka4IqFssbz5UEbDCobg"
        val severUri = "https://bxvikpvp.lc-cn-n1-shared.com"
        // 提供 this、App ID、App Key、Server Host 作为参数
        // 注意这里千万不要调用 cn.leancloud.core.AVOSCloud 的 initialize 方法，否则会出现 NetworkOnMainThread 等错误。
        AVOSCloud.initialize(this, appId, appKey, severUri);


    }

}